package dkffkd23.basic;

public class J14_ExtendClass {

	public static void main(String[] args) {
		//객체지향 특성 : 상속
		J14_SungJuk sj= new J14_SungJuk("지현", 99, 78, 55);
		System.out.println(sj.getTotal());
		
		J14_SungJuk_Extend sje=new J14_SungJuk_Extend("qhqh", 67, 85, 24, 67, 99);
		System.out.println(sje.getTotal());
		

	}//메인

}//클래스

class J14_SungJuk{
	private String name;
	private int kor;
	private int eng;
	private int mat;
	public J14_SungJuk(String name, int kor, int eng, int mat) {
		super();
		this.name = name;
		this.kor = kor;
		this.eng = eng;
		this.mat = mat;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getKor() {
		return kor;
	}
	public void setKor(int kor) {
		this.kor = kor;
	}
	public int getEng() {
		return eng;
	}
	public void setEng(int eng) {
		this.eng = eng;
	}
	public int getMat() {
		return mat;
	}
	public void setMat(int mat) {
		this.mat = mat;
	}
	
	public int getTotal(){
		return kor+eng+mat;
	}
}

class J14_SungJuk2{
	
	private String name;
	private int kor;
	private int eng;
	private int mat;
	private int soc;
	private int art;
	
	
	
	public J14_SungJuk2(String name, int kor, int eng, int mat, int soc, int art) {
		this.name = name;
		this.kor = kor;
		this.eng = eng;
		this.mat = mat;
		this.soc = soc;
		this.art = art;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getKor() {
		return kor;
	}
	public void setKor(int kor) {
		this.kor = kor;
	}
	public int getEng() {
		return eng;
	}
	public void setEng(int eng) {
		this.eng = eng;
	}
	public int getMat() {
		return mat;
	}
	public void setMat(int mat) {
		this.mat = mat;
	}
	public int getSoc() {
		return soc;
	}
	public void setSoc(int soc) {
		this.soc = soc;
	}
	public int getArt() {
		return art;
	}
	public void setArt(int art) {
		this.art = art;
	}
	
	
}

class J14_SungJuk_Extend extends J14_SungJuk{
	
	private int soc;
	private int art;
	public int getSoc() {
		return soc;
	}
	public void setSoc(int soc) {
		this.soc = soc;
	}
	public int getArt() {
		return art;
	}
	public void setArt(int art) {
		this.art = art;
	}
	public J14_SungJuk_Extend(String name, int kor, int eng, int mat, int soc,
			int art) {
		super(name, kor, eng, mat);
		//super는 상속관계에서 부모클래스의 생성자를 의미함
		//따라서, super()는 J14_SungJuk2의 J14_SungJuk2(name,kor,eng,mat)를 의미
		this.soc = soc;
		this.art = art;
	}
	
	@Override
	public int getTotal() {
		//return kor + eng + mat + soc + art;
		return super.getTotal()+soc+art;
		//super는 상속관계에서 부모 클래스를 의미한다. 
		//따라서 J14_SungJuk클래스의 getTotal메서드를 가르킨다.
	}
	
}



